-- @owner:魏亚军
-- @date:2023-12-18
-- @testpoint:4.测试在事务中修改序列步长

--step1:创建普通序列，步长为1，其他属性为默认值;expect:成功
drop sequence if exists seqopengauss_alter_sequence_increment_case0004_1;
create sequence seqopengauss_alter_sequence_increment_case0004_1 increment 1;

--step2:查看当前序列步长;expect:成功(1 row)
select increment_by from seqopengauss_alter_sequence_increment_case0004_1;

--step3:激活当前序列;expect:成功(1 row)
select nextval('seqopengauss_alter_sequence_increment_case0004_1');

--step4:查看步长设置是否生效;expect:成功(1 row)
select nextval('seqopengauss_alter_sequence_increment_case0004_1');

--step5:在事务中修改序列;expect:成功
begin
alter sequence seqopengauss_alter_sequence_increment_case0004_1 increment 100;
end;
/

--step6:查看当前序列步长;expect:成功(1 row)
select increment_by from seqopengauss_alter_sequence_increment_case0004_1;

--step7:验证修改是否生效;expect:成功(1 row)
select nextval('seqopengauss_alter_sequence_increment_case0004_1');

--step8:在事务中修改序列;expect:成功(1 row)
begin;
alter sequence seqopengauss_alter_sequence_increment_case0004_1 increment 10;
--step9:提交事务，验证步长是否修改
end;
/

--step10:查看当前序列步长;expect:成功(1 row)
select increment_by from seqopengauss_alter_sequence_increment_case0004_1;

--step11:验证修改是否生效;expect:成功(1 row)
select nextval('seqopengauss_alter_sequence_increment_case0004_1');

--step12:清理环境;except:成功
drop sequence seqopengauss_alter_sequence_increment_case0004_1;